<div class="page cariproperti">
    <div class="container">
        <div class="row">
            <div class="span4 perincianpencarian">
                <div class="span3 title">
                    <h4>Perincian Pencarian</h4>
                </div>
                <form method="GET" action="<?php echo site_url('search/cari/') ?>">
                    <div class="row jual-beli">
                        <div class="span1">     
                            <label class="radio">
                                <input type="radio" name="mode" id="optionsRadios1" value="1" data-toggle="radio" <?php if ($this->input->get('mode', TRUE) == 1) echo "checked=''" ?>>
                                Jual
                            </label>
                        </div>
                        <div class="span1">
                            <label class="radio">
                                <input type="radio" name="mode" id="optionsRadios2" value="2" data-toggle="radio" <?php if ($this->input->get('mode', TRUE) == 2) echo "checked=''" ?>>
                                Sewa
                            </label>
                        </div>
                    </div>
                    <div class="span3">
                        <select name="tipe" value="0" class="select-block span3">
                            <option value="" selected>
                                Tipe Properti
                            </option>
                            <?php
                            $i = 1;
                            foreach ($tipe->result() as $value) {
                                echo "<option value='" . $i . "'";
                                if ($this->input->get('mandi', TRUE) == $i) {
                                    echo "selected";
                                }
                                $i++;
                                echo ">";
                                echo $value->nama;
                                echo "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div class="span3">
                        <select name="area" value="Villa" class="select-block span3">
                            <option value="0" selected>
                                Area
                            </option>
                            <?php
                            $i = 1;
                            foreach ($area->result() as $value) {
                                if ($this->input->get('area', TRUE) == $i) {
                                    echo "<option value='" . $i++ . "' selected>";
                                } else {
                                    echo "<option value='" . $i++ . "'>";
                                }
                                echo $value->kota_kab;
                                echo "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div class="span3">
                        <select name="tidur" value="Villa" class="select-block span3">
                            <option value="" selected="selected">Kamar Tidur</option>
                            <?php
                            $i = 1;
                            while ($i < 10) {
                                echo "<option value='" . $i . "'";
                                if ($this->input->get('tidur', TRUE) == $i) {
                                    echo "selected";
                                }
                                echo ">";
                                echo $i++;
                                echo "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div class="span3">
                        <select name="mandi" value="Villa" class="select-block span3">
                            <option value="" selected="selected">Kamar Mandi</option>
                            <?php
                            $i = 1;
                            while ($i < 10) {
                                echo "<option value='" . $i . "'";
                                if ($this->input->get('mandi', TRUE) == $i) {
                                    echo "selected";
                                }
                                echo ">";
                                echo $i++;
                                echo "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div class="span3">
                        <select name="area" value="Villa" class="select-block span3">
                            <option value="0" selected="selected">Luas</option>
                            <?php
                            $i = 1;
                            while ($i < 10) {
                                echo "<option value='" . $i . "'>";
                                echo $i++ . "00 meter persegi";
                                echo "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div class="span3">
                        <select name="hargamin" value="Villa" class="select-block span3">
                            <option value="0" selected="selected">Harga Minimum</option>
                            <?php
                            $i = 1;
                            while ($i < 10) {
                                echo "<option value='" . $i . "00000000' ";
                                if ($this->input->get('hargamin', TRUE) == ($i . "00000000")) {
                                    echo "selected";
                                }
                                echo ">";
                                echo "Rp. " . $i++ . "00 juta";
                                echo "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div class="span3">
                        <select name="hargamaks" value="Villa" class="select-block span3">
                            <option value="1000000000000" selected="selected">Harga Maksimum</option>
                            <?php
                            $i = 1;
                            while ($i < 10) {
                                echo "<option value='" . $i . "000000000' ";
                                if ($this->input->get('hargamaks', TRUE) == ($i . "000000000")) {
                                    echo "selected";
                                }
                                echo ">";
                                echo "Rp. " . $i++ . " Milyar";
                                echo "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div class="span3">
                        <select name="sertifikat" value="Villa" class="select-block span3">
                            <option value="" selected="selected">Sertifikat</option>
                            <?php
                            $i = 1;
                            foreach ($sertifikat->result() as $value) {
                                echo "<option value='" . $i++ . "'";
                                if ($this->input->get('sertifikat', TRUE) == $i) {
                                    echo "selected";
                                }
                                echo ">";
                                echo $value->nama_sertifikat;
                                echo "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div class="span3">
                        Kata Kunci :
                        <input type="text" value="<?php echo $search; ?>" name="search" class="span3" />
                    </div>
                    <div class="span2 submitpencarian">
                        <input type="submit" value="CARI" class="btn btn-large btn-block btn-primary submitpencarian" />
                    </div>
                </form>
            </div>
            <div class="span8 daftarproperti">
                <?php
                $bulan = array(
                    "01" => "Jan",
                    "02" => "Feb",
                    "03" => "Mar",
                    "04" => "Apr",
                    "05" => "Mei",
                    "06" => "Jun",
                    "07" => "Jul",
                    "08" => "Aug",
                    "09" => "Sept",
                    "10" => "Okt",
                    "11" => "Nov",
                    "12" => "Des"
                );
                ?>
                <div class="row">
                    <div class="span3 urutanberdasarkan">
                        <select name="urutkanberdasarkan" value="urutan" class="select-block span3">
                            <option value="0" selected="selected">Urutkan Berdasarkan</option>
                            <option value="Listing Terbaru">Listing Terbaru</option>
                            <option value="Listing Terpopuler">Listing Terpopuler</option>
                            <option value="Harga Min-Maks">Harga Min-Maks</option>
                            <option value="Harga Maks-Min">Harga Maks-Min</option>
                            <option value="Ukuran Besar ke Kecil">Ukuran Besar ke Kecil</option>
                            <option value="Ukuran Kecil ke Besar">Ukuran Kecil ke Besar</option>
                        </select>
                    </div>
                    <div class="span2 hasilperhalaman pull-right">
                        <select name="hasilperhalaman" value="hasilperhalaman" class="select-block span2">
                            <option value="0" selected="selected">Hasil Perhalaman</option>
                            <option value="10">10 perhalaman</option>
                            <option value="20">20 perhalaman</option>
                            <option value="30">30 perhalaman</option>
                            <option value="40">40 perhalaman</option>
                            <option value="50">50 perhalaman</option>
                        </select>
                    </div>
                </div>
                <?php
                if ($result->num_rows() > 0) {
                    foreach ($result->result() as $value) {
                        ?>
                        <div class="span8 properti">
                            <div class="span8 judulproperti">
                                <h4><?php echo $value->nama_properti; ?></h4>
                            </div>
                            <div class="row">
                                <div class="span2">
                                    <?php
//                                    //echo substr($value->tgl_update, 8, 2) . " " .
                                    //$bulan[substr($value->tgl_update, 5, 2)] . " " . substr($value->tgl_update, 0, 4);
                                    ?>
                                    <img src="<?php echo base_url(); ?>assets/img/icon.png" class="img-polaroid">

                                    <a href="" class="btn btn-lihatdetail">Lihat Detail</a>


                                    <a href="" class="btn btn-peta">Peta</a>


                                </div>
                                <div class="span4">
                                    <h4>Rp.
                                        <?php
                                        echo number_format($value->harga);
                                        ?>
                                    </h4>
                                    <p> 
                                        <?php
                                        echo $value->nama . " ";
                                        if ($value->sewa_beli == 1) {
                                            echo "dijual";
                                        } else {
                                            echo "disewakan";
                                        }
                                        ?>
                                        <br/>
                                    <div class="row">
                                        <div class="span2">
                                            <p class="palette-paragraph">
                                                Kamar Mandi <?php echo $value->jml_kmr_mandi; ?> <br />
                                                Kamar Tidur <?php echo $value->jml_kmr_tidur; ?> <br />
                                                <?php echo $value->tipe_furnitur ?>
                                            </p>

                                        </div>
                                        <div class="span2">
                                            <p class="palette-paragraph">
                                                Luas Bangunan <?php echo $value->luas_bangunan; ?> m<sup>2</sup> <br/>
                                                Luas Tanah <?php echo $value->luas_tanah; ?> m<sup>2</sup> <br/>
                                                Sertifikat : <?php echo $value->nama_sertifikat; ?>
                                            </p>
                                        </div>
                                    </div>
                                    <p class="palette-paragraph">( Diiklankan tanggal
                                        <?php
                                        echo substr($value->tgl_update, 8, 2) . " " .
                                        $bulan[substr($value->tgl_update, 5, 2)] . " " .
                                        substr($value->tgl_update, 0, 4);
                                        ?>
                                        )</p>                    
                                    </p>
                                </div>
                                <div class="span2 infoagen">
                                    <div class="span2 fotoagen">
                                        <img src="<?php echo base_url(); ?>assets/img/icon.png" class="img-polaroid">
                                    </div>
                                    <p class="palette-paragraph">
                                        <?php echo $value->nama_depan . " " . $value->nama_belakang; ?>
                                        <br />
                                        HP : 
                                        <?php echo $value->no_hp; ?>
                                        <br />
                                        BB :
                                        <?php echo $value->pin_bb; ?>
                                        <br />
                                    </p>
                                    <div class="span2 hubungiagen">
                                        <a href="#myModal" data-toggle="modal" class="btn btn-small btn-block btn-primary">Hubungi Agen</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php
                    }
                }
                ?>
            </div>
        </div>
    </div>
</div>
<div id="myModal" class="span5 modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 id="myModalLabel">Insert your e-mail here</h4>
    </div>
    <form>
        <div class="modal-body">
            <div class="span4">
                <input type="text" value="" placeholder="E-mail..." class="span4" />
            </div>
            <div class="span2 emailsubmit">
                <input type="submit" value="SUBMIT" class="btn btn-primary" />
            </div>
        </div>
        /form>
</div>
<?php
echo $search == "";
?>